import request from '@/utils/request'

// 班级

export function fetchList(query) {
  return request({
    url: '/admin/classes',
    method: 'get',
    params: query
  })
}

// 班级人数
export function fetchListStudent(query) {
  return request({
    url: '/admin/classes/number',
    method: 'get',
    params: query
  })
}

// 查看某个班级的照片
export function fetchPhoto(classId) {
  return request({
    url: `/admin/classes/${classId}/photos`,
    method: 'get'
  })
}

// 删除某张照片
export function fetchDeletePhoto(photoId) {
  return request({
    url: `/admin/classes/photos/${photoId}`,
    method: 'post'
  })
}

export function fetchAdd(data) {
  return request({
    url: '/admin/classes',
    method: 'post',
    data
  })
}

export function fetchEdit({
  id,
  ...data
}) {
  return request({
    url: `/admin/classes/${id}`,
    method: 'put',
    data
  })
}

export function fetchDelete(id) {
  return request({
    url: `/admin/classes/${id}`,
    method: 'delete'
  })
}
